import React from 'react'
import {useEffect,useState} from "react"
import Shortitem from '../components/shortitem'
import axios from 'axios'
function ShortVideo(props) {
  let [arr,setArr] = useState([])
  useEffect(()=>{
     axios.get("/list1").then(res=>{
       console.log(res.data);
       setArr(res.data.list)
     })
  },[])
  const godetail = (id)=>{
      console.log(id);
      props.history.push({
        pathname:"/detail/" + id
      })
  }
  return (
    <div>
      {
        arr && arr.length ? arr.map((item,index)=>{
          return <Shortitem arr={item} key={index}></Shortitem>
        }):"暂无数据"
      }
    </div>
  )
}

export default ShortVideo